@page "/presentation/create-animation"
@inject Microsoft.JSInterop.IJSRuntime JS
@using System.IO
@using Syncfusion.Blazor.Buttons
@inject Microsoft.AspNetCore.Hosting.IWebHostEnvironment hostingEnvironment
@using BlazorDemos.Data.FileFormats.Presentation
@inherits SampleBaseComponent;

<SampleDescription>
    <p style="font-size:16px">This sample demonstrates how to add different animation effect for shapes.</p>
</SampleDescription>
<ActionDescription>
   <b style="font-size:16px">Features:</b>
    <br />
    <div>
      <p style="font-size:16px">The below animation effects are supported as equivalent to Microsoft PowerPoint: </p>
        <ul style="font-size:16px">
            <li>Entrance</li>
            <li>Emphasis</li>
            <li>Exit</li>
             <li>Motion Paths</li>
        </ul>
    </div>
    <br />
    <div>
        <p style="font-size:16px">The below animation options are supported as equivalent to Microsoft PowerPoint:</p>
            <ul style="font-size:16px">
                <li>Effect options</li>
                <li>Add multiple animation</li>
                <li>Trigger</li>
                <li>Animation timing</li>
            </ul>
</div>
    <br />
</ActionDescription>

<div class="control-section">
    <p style="font-size:16px">Click the button to view a PowerPoint presentation generated by Essential Presentation. Please note that Microsoft PowerPoint viewer or its equivalent is required to view the resultant document.</p>
        
    <div class="button-section">
        <div id="button-control">
            <div class="row">
                <div>
                    <SfButton @onclick="CreateAnimationSlide">Create Presentation</SfButton>
                </div>
            </div>
        </div>
    </div>
</div>

<style>
    .control-section .row {
        margin: 10px 0;
    }
</style>

@code {
    MemoryStream documentStream;    

    /// <summary>
    /// Create and download the Presentation document
    /// </summary>
    public async Task CreateAnimationSlide(MouseEventArgs args)
    {
        AnimationService service = new AnimationService(hostingEnvironment);
        documentStream = service.CreateAnimationPresentation();
        await JS.SaveAs("CreateAnimation.pptx", documentStream.ToArray());       
    }
}